package xyz.hubery.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.Collections;
import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.util.StringUtils;
import xyz.hubery.domain.CoinType;
import xyz.hubery.mapper.CoinTypeMapper;
import xyz.hubery.service.CoinTypeService;

@Service
public class CoinTypeServiceImpl extends ServiceImpl<CoinTypeMapper, CoinType> implements CoinTypeService {


    @Override
    public Page<CoinType> findPage(Page<CoinType> page, String code) {
        return page(page, new LambdaQueryWrapper<CoinType>().eq(!StringUtils.isEmpty(code), CoinType::getCode, code));
    }

    @Override
    public List<CoinType> listByStatus(Byte status) {
        return list(new LambdaQueryWrapper<CoinType>().eq(status != null, CoinType::getStatus, status));
    }
}
